<template>
  <div class="add_dialog text-center">
    <el-link class="flex-1" type="primary" :underline="false" @click="dialogFormVisible = true"
      >回复</el-link
    >
    <el-dialog
      v-model="dialogFormVisible"
      width="85%"
      style="max-width: 700px"
      append-to-body
      class="dialog_form"
      :close-delay="10"
      :lock-scroll="false"
      destroy-on-close
      title="回复"
    >
      <div class="">
        <!-- <el-form :model="item">
          <div class="flex">
            <el-form-item label="发送人" class="flex-1">
              {{ item.email }}
            </el-form-item>
            <el-form-item label="发送时间" class="flex-1">
              {{ item.date }}
            </el-form-item>
          </div>
          <el-form-item label="内容">
            {{ item.body }}
          </el-form-item>
        </el-form> -->
        <div class="flex-1 shrink-0">
          <el-form :model="form">
            <div class="flex">
              <el-form-item label="回复人" prop="send" class="flex-1">
                <el-mention
                  v-model="form.send"
                  whole
                  :options="sendList"
                  placeholder="输入@选择回复人"
                />
              </el-form-item>
              <el-form-item label="抄送" prop="reply" class="flex-1">
                <el-mention
                  v-model="form.reply"
                  whole
                  :options="sendList"
                  placeholder="输入@选择抄送人"
                />
              </el-form-item>
            </div>
            <el-form-item label="内容" prop="content">
              <el-input
                v-model="form.content"
                :autosize="{ minRows: 2 }"
                type="textarea"
                placeholder="输入内容"
              />
            </el-form-item>
          </el-form>
        </div>
        <div class="flex-1 shrink-0">
          <div class="changyong">常用回复</div>
          <div class="use-box flex justify-between" v-for="(item, index) in useList" :key="index">
            <div class="name">{{ item.label }}</div>
            <div class="hand" @click="form.content = form.content + '\n' + item.label">引用</div>
          </div>
        </div>
      </div>
      <template #footer>
        <el-button type="primary" @click="dialogFormVisible = false">发送</el-button>
        <el-button @click="dialogFormVisible = false"> 关闭 </el-button>
      </template>
    </el-dialog>
  </div>
</template>
<script setup lang="ts">
const props = defineProps({
  item: {
    type: Object,
    default: () => ({})
  }
})
const dialogFormVisible = ref(false)
const form: any = reactive({
  send: '',
  reply: '',
  content: '',
  type: 'reply'
})
const sendList = ref(['Fuphoenixes', 'kooriookami', 'Jeremy', 'btea'].map((value) => ({ value })))
const useList = [
  {
    label: '常用回复常用回复常用回复'
  },
  {
    label: '常用回复常用回复常用回复'
  }
]
form.content = props.item.body
form.send = props.item.email
</script>
<style lang="scss" scoped>
:deep(.dialog_form) {
  max-width: 300px;
}
.changyong {
  font-size: 14px;
  color: #212429;
  text-align: left;
}
.use-box {
  padding: 3px 0;
  border-bottom: 1px solid #eaeef5;
  .name {
    font-size: 13px;
    color: #565b66;
  }
  .hand {
    font-size: 13px;
    color: #1763ff;
    cursor: pointer;
  }
}
</style>
